package com.example.designpattenexample.memento;

/**
 * 备忘录模式
 */
/** 发起人角色 */
public class Originator {

    private String state = "";

    public void setState(String state){
        this.state = state;
    }

    public String getState(){
        return this.state;
    }

    public Memento createMemento(){
        return new Memento(state);
    }

    public void restoreMemento(Memento memento){
        this.setState(memento.getState());
    }
}
